<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        document.addEventListener('keyup', function(e) {
            console.log('我弹起了');
            console.log('up:' + e.keyCode);
        })

            document.addEventListener('keydown', function(e) {
                // console.log('我按下了');
                console.log('down:' + e.keyCode);
            })
        document.addEventListener('keypress', function(e) {
            // console.log('我按下了1'); //不能识别功能键
            console.log('press:' + e.keyCode);

        })
    </script>
</body>

</html>